#include "calc.h"
#include "gtest/gtest.h"
#include <iostream>

TEST(Calc, Add)
{
    Calc<int> c;
    EXPECT_EQ(3, c.Add(1, 2));
}

TEST(Add, add)
{
    Calc<int> c;
    std::cout << c.Add(1, 2) << std::endl;
}

TEST(PerformanceTest, VectorPushBack)
{
    const int N = 1000000;
    std::vector<int> v;

    auto start = std::chrono::high_resolution_clock::now();
    for (int i = 0; i < N; ++i)
    {
        v.push_back(i);
    }
    auto end = std::chrono::high_resolution_clock::now();

    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
    std::cout << "Time taken: " << duration.count() << " ms" << std::endl;

    // 性能断言
    ASSERT_LT(duration.count(), 5000); // 应在50ms内完成
}
